<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Zookeeper,ActiveMQ," />





  <link rel="alternate" href="/atom.xml" title="Hfbin Blog" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />






<meta name="description" content="1 前言&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;使用ZooKeeper实现的Master-Slave实现方式，是对ActiveMQ进行高可用的一种有效的解决方案，高可用的原理：使用ZooKeeper（集群）注册所有的ActiveMQ Broker。只有其中的一个Broker可以对外提供服务（也就是Master节点），其 他的Broker处于待机状态，被视为Slave">
<meta name="keywords" content="Zookeeper,ActiveMQ">
<meta property="og:type" content="article">
<meta property="og:title" content="Zookeeper+ActiveMQ集群搭建">
<meta property="og:url" content="http://yoursite.com/2017/12/02/Zookeeper+ActiveMQ集群搭建/index.html">
<meta property="og:site_name" content="Hfbin Blog">
<meta property="og:description" content="1 前言&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;使用ZooKeeper实现的Master-Slave实现方式，是对ActiveMQ进行高可用的一种有效的解决方案，高可用的原理：使用ZooKeeper（集群）注册所有的ActiveMQ Broker。只有其中的一个Broker可以对外提供服务（也就是Master节点），其 他的Broker处于待机状态，被视为Slave">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://img.blog.csdn.net/20171223143709938?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223153704984?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223155724897?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223160217180?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223162200901?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223162315705?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223162503915?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223163211246?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="http://img.blog.csdn.net/20171223163806772?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:updated_time" content="2018-01-06T06:22:49.370Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Zookeeper+ActiveMQ集群搭建">
<meta name="twitter:description" content="1 前言&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;使用ZooKeeper实现的Master-Slave实现方式，是对ActiveMQ进行高可用的一种有效的解决方案，高可用的原理：使用ZooKeeper（集群）注册所有的ActiveMQ Broker。只有其中的一个Broker可以对外提供服务（也就是Master节点），其 他的Broker处于待机状态，被视为Slave">
<meta name="twitter:image" content="http://img.blog.csdn.net/20171223143709938?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: 'FQWD7RL0XS',
      apiKey: 'ad0b6762f0b7721176ce7c215ba85c58',
      indexName: 'hfbin',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>

<script>
    (function(){
        if(''){
            if (prompt('该文章博主已加密') !== ''){
                alert('密码错误！');
                history.back();
            }
        }
    })();
</script>


  <link rel="canonical" href="http://yoursite.com/2017/12/02/Zookeeper+ActiveMQ集群搭建/"/>

    <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
	<link href="//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">
<style>
    .pace .pace-progress {
        background: #1E92FB; /*进度条颜色*/
        height: 3px;
    }
    .pace .pace-progress-inner {
         box-shadow: 0 0 10px #1E92FB, 0 0 5px     #1E92FB; /*阴影颜色*/
    }
    .pace .pace-activity {
        border-top-color: #1E92FB;    /*上边框颜色*/
        border-left-color: #1E92FB;    /*左边框颜色*/
    }
</style>

	


  <title>Zookeeper+ActiveMQ集群搭建 | Hfbin Blog</title>
  












  <div style="display: none;">
    <script src="//s95.cnzz.com/z_stat.php?id=1266987503&web_id=1266987503" language="JavaScript"></script>
  </div>





</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

 
    

  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script type="text/javascript" src="/js/src/algolia.js?v=5.1.2"></script>

  
  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"></span>
        <span class="site-title">Hfbin Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">My friend promised me to go if I had the road</p>
      
  </div>

  <div class="site-nav-toggle" style="position: absolute; float: left; ">
    <button>
      <span class="btn-bar" style="background: #fff;"></span>
      <span class="btn-bar" style="background: #fff;"></span>
      <span class="btn-bar" style="background: #fff;"></span>
    </button>
  </div>
</div>

<nav class="site-nav" >
  <!-- set hasSearch = theme.swiftype_key || theme.algolia_search.enable || theme.tinysou_Key || theme.local_search.enable % -->
  	


  
    <ul id="menu" class="menu" >
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
			 <!-- 增加下面语句 -->
		  
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/12/02/Zookeeper+ActiveMQ集群搭建/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="HuangFuBin">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://avatars3.githubusercontent.com/u/26451830?s=400&u=fac2b4c7903b3ad1210b530e2d18e42fcb410b0a&v=4">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Hfbin Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Zookeeper+ActiveMQ集群搭建</h1>
        

        <div class="post-meta">
			 
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-12-02T11:19:55+08:00">
                2017-12-02
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Zookeeper-ActiveMQ/" itemprop="url" rel="index">
                    <span itemprop="name">Zookeeper+ActiveMQ</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-comment-o"></i>
              </span>
              
                <a href="/2017/12/02/Zookeeper+ActiveMQ集群搭建/#SOHUCS" itemprop="discussionUrl">
                  <span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="2017/12/02/Zookeeper+ActiveMQ集群搭建/" itemprop="commentsCount"></span>
                </a>
              
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h4 id="1-前言"><a href="#1-前言" class="headerlink" title="1 前言"></a><strong>1 前言</strong></h4><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用ZooKeeper实现的Master-Slave实现方式，是对ActiveMQ进行高可用的一种有效的解决方案，高可用的原理：使用ZooKeeper（集群）注册所有的ActiveMQ Broker。只有其中的一个Broker可以对外提供服务（也就是Master节点），其 他的Broker处于待机状态，被视为Slave。如果Master因故障而不能提供服务， 则利用ZooKeeper的内部选举机制会从Slave中选举出一个Broker充当Master节 点，继续对外提供服务。</p>
<p>原理图：</p>
<p><img src="http://img.blog.csdn.net/20171223143709938?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述"></p>
<p>官方文档：<a href="http://activemq.apache.org/replicated-leveldb-store.html" target="_blank" rel="external">http://activemq.apache.org/replicated-leveldb-store.html</a></p>
<h4 id="2-部署方案，ZooKeeper、ActiveMQ集群环境准备"><a href="#2-部署方案，ZooKeeper、ActiveMQ集群环境准备" class="headerlink" title="2 部署方案，ZooKeeper、ActiveMQ集群环境准备"></a><strong>2 部署方案，ZooKeeper、ActiveMQ集群环境准备</strong></h4><p>这里需要下载apache-activemq-5.11.1bin.tar.gz、zookeeper-3.3.6.tar.gz文件，可以到官网去下载。</p>
<p>apache-activemq-5.11.1bin.tar.gz、zookeeper-3.3.6.tar.gz百度云链接：链接：<a href="https://pan.baidu.com/s/1ge5htFP" target="_blank" rel="external">https://pan.baidu.com/s/1ge5htFP</a> 密码：lkb6</p>
<h5 id="2、1-Zookeeper方案"><a href="#2、1-Zookeeper方案" class="headerlink" title="2、1 Zookeeper方案"></a><strong>2、1 Zookeeper方案</strong></h5><table>
<thead>
<tr>
<th style="text-align:left">主机IP</th>
<th style="text-align:center">消息端口</th>
<th style="text-align:center">通信端口</th>
<th style="text-align:center">节点目录/opt/下</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">192.168.0.107</td>
<td style="text-align:center">2181</td>
<td style="text-align:center">2888:3888</td>
<td style="text-align:center">zookeeper-3.3.6</td>
</tr>
<tr>
<td style="text-align:left">192.168.0.108</td>
<td style="text-align:center">2181</td>
<td style="text-align:center">2888:3888</td>
<td style="text-align:center">zookeeper-3.3.6</td>
</tr>
<tr>
<td style="text-align:left">192.168.0.109</td>
<td style="text-align:center">2181</td>
<td style="text-align:center">2888:3888</td>
<td style="text-align:center">zookeeper-3.3.6</td>
</tr>
</tbody>
</table>
<h5 id="2、2-ActiveMQ方案"><a href="#2、2-ActiveMQ方案" class="headerlink" title="2、2 ActiveMQ方案"></a><strong>2、2 ActiveMQ方案</strong></h5><table>
<thead>
<tr>
<th style="text-align:left">主机IP</th>
<th style="text-align:center">集群通信端口</th>
<th style="text-align:center">消息端口</th>
<th style="text-align:center">控制台端口</th>
<th style="text-align:center">节点目录/opt/下</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">192.168.0.107</td>
<td style="text-align:center">62621</td>
<td style="text-align:center">51511</td>
<td style="text-align:center">8161</td>
<td style="text-align:center">activemq-cluster/node1/</td>
</tr>
<tr>
<td style="text-align:left">192.168.0.107</td>
<td style="text-align:center">62621</td>
<td style="text-align:center">51512</td>
<td style="text-align:center">8162</td>
<td style="text-align:center">activemq-cluster/node1/</td>
</tr>
<tr>
<td style="text-align:left">192.168.0.107</td>
<td style="text-align:center">62621</td>
<td style="text-align:center">51513</td>
<td style="text-align:center">8163</td>
<td style="text-align:center">activemq-cluster/node1/</td>
</tr>
</tbody>
</table>
<p>ActiveMQ集群我部署在一台机器上而已，你感兴趣的话看完这篇文章，不妨你把ActiveMQ搭建到每一台机器上。</p>
<h5 id="2、3-Zookeeper集群搭建"><a href="#2、3-Zookeeper集群搭建" class="headerlink" title="2、3 Zookeeper集群搭建"></a><strong>2、3 Zookeeper集群搭建</strong></h5><p>将zookeeper-3.3.6.tar.gz上传到/opt目录下</p>
<p>下面三台机器都是使用同一个操作，如有不同我会另作说明</p>
<p>解压</p>
<pre><code>shell&gt;tar -zxvf zookeeper-3.3.6.tar.gz
</code></pre><p>进入conf目录</p>
<pre><code>shell&gt;cd zookeeper-3.3.6/conf
</code></pre><p>将zoo_sample.cfg文件名改为zoo.cfg</p>
<pre><code>shell&gt;mv zoo_sample.cfg zoo.cfg
</code></pre><p>编辑zoo.cfg</p>
<pre><code>shell&gt;vim zoo.cfg
</code></pre><p>修改dataDir路径</p>
<pre><code>dataDir=/opt/zookeeper-3.3.6/data
</code></pre><p>加入内容</p>
<pre><code>server.0=192.168.0.109:2888:3888
server.1=192.168.0.107:2888:3888
server.2=192.168.0.108:2888:3888
</code></pre><p><img src="http://img.blog.csdn.net/20171223153704984?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="我也不懂为什么上传后的图片变模糊了，估计是csdn....."></p>
<p>这里几个参数我说明一下：</p>
<pre><code>tickTime: zookeeper中使用的基本时间单位, 毫秒值.
dataDir: 数据目录. 可以是任意目录.
dataLogDir: log目录, 同样可以是任意目录. 如果没有设置该参数, 将使用和dataDir相同的设置.（这里我不配置）
clientPort: 监听client连接的端口号.
</code></pre><p>还需修改最后一个文件zookeeper集群就算搭建完成了</p>
<p>进入data目录</p>
<pre><code>shell&gt;cd zookeeper-3.3.6/data
</code></pre><p>编辑myid每台机器只需要加入你在zoo.cfg中加入的server配置对应得数字即可。</p>
<pre><code>shell&gt;vim myid
</code></pre><p>192.168.0.109内容如下</p>
<pre><code>0
</code></pre><p>192.168.0.108内容如下</p>
<pre><code>1
</code></pre><p>192.168.0.107内容如下</p>
<pre><code>2
</code></pre><p>好到这就算配置完成了启动zookeeper试一下，是否成功：</p>
<p>启动服务端：<br><img src="http://img.blog.csdn.net/20171223155724897?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述"></p>
<p>启动客户端：</p>
<p><img src="http://img.blog.csdn.net/20171223160217180?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述"></p>
<p>好zookeeper集群的搭建到这就完成了。</p>
<h5 id="2、4-ActiveMQ集群搭建"><a href="#2、4-ActiveMQ集群搭建" class="headerlink" title="2、4 ActiveMQ集群搭建"></a><strong>2、4 ActiveMQ集群搭建</strong></h5><p>将apache-activemq-5.11.1bin.tar.gz上传到/opt目录下</p>
<p>在192.168.0.107节点下，创建/opt/activemqcluster文件夹，解压apache-activemq-5.11.1bin.tar.gz文件，然后对解压好的文件改名，操作如下： </p>
<pre><code>shell&gt;mkdir /opt/activemq-cluster 
shell&gt;cd opt/ 
shell&gt;tar -zxvf apache-activemq-5.11.1-bin.tar.gz -C /opt/activemq-cluster/ 
shell&gt;cd /opt/activemq-cluster/ 
shell&gt;mv apache-activemq-5.11.1/ node1
</code></pre><p>如此操作，再次反复解压apache-activemq-5.11.1bin.tar.gz文件到/opt/activemq-cluster/下，建立node2和node3文件夹，如下:</p>
<p>那我们现在已经解压好了三个ActiveMQ节点也就是node1、node2、node3，下面 我们要做的事情就是更改每个节点不同的配置和端口（由于是在一台机器上实现集群）</p>
<p><strong>1 修改控制台端口（默认为8161)</strong></p>
<p>在mq安装路径下的conf/jetty.xml进行修改即可。（三个节点都要修改，并且端口都不同） </p>
<pre><code>shell&gt;cd /opt/activemq-cluster/node1/conf/ 

shell&gt;vim jetty.xml
</code></pre><p><img src="http://img.blog.csdn.net/20171223162200901?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述"></p>
<p>三个节点都需要修改为8161、8162、8163！！！</p>
<p><strong>2 集群配置文件修改</strong></p>
<p>我们在mq安装路径下的conf/activemq.xml进行修改其中的持久化适配器，修改其中的bind、zkAddress、hostname、zkPath。 然后也需要修改mq的brokerName，并且每个节点名称都必须相同。 </p>
<p>命令：vim /opt/activemq-cluster/node1/conf/activemq.xml </p>
<p>第一处修改：brokerName=”activemq-cluster”（三个节点都需要修改）<br><img src="http://img.blog.csdn.net/20171223162315705?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述"></p>
<p>第二处修改：先注释掉适配器（persistenceAdapter标签）中的kahadb,添加新的leveldb配置如下（三个节点都需要修改）,内容如下：<br>Node1: </p>
<pre><code>&lt;persistenceAdapter&gt;
         &lt;!--kahaDB directory=&quot;${activemq.data}/kahadb&quot;/ --&gt;
         &lt;replicatedLevelDB
                directory=&quot;${activemq.data}/leveldb&quot;
                replicas=&quot;3&quot; 
                bind=&quot;tcp://0.0.0.0:62621&quot;
                zkAddress=&quot;192.168.0.107:2181,192.168.0.108:2181,192.168.0.109:2181&quot;
                hostname=&quot;hfbin107&quot;
                zkPath=&quot;/activemq/leveldb-stores&quot;/&gt;
&lt;/persistenceAdapter&gt;
</code></pre><p>Node2: </p>
<pre><code>&lt;persistenceAdapter&gt;
         &lt;!--kahaDB directory=&quot;${activemq.data}/kahadb&quot;/ --&gt;
         &lt;replicatedLevelDB
                directory=&quot;${activemq.data}/leveldb&quot;
                replicas=&quot;3&quot; 
                bind=&quot;tcp://0.0.0.0:62622&quot;
                zkAddress=&quot;192.168.0.107:2181,192.168.0.108:2181,192.168.0.109:2181&quot;
                hostname=&quot;hfbin107&quot;
                zkPath=&quot;/activemq/leveldb-stores&quot;/&gt;
&lt;/persistenceAdapter&gt;
</code></pre><p>Node3:</p>
<pre><code>&lt;persistenceAdapter&gt;
         &lt;!--kahaDB directory=&quot;${activemq.data}/kahadb&quot;/ --&gt;
         &lt;replicatedLevelDB 
                directory=&quot;${activemq.data}/leveldb&quot; 
                replicas=&quot;3&quot; 
                bind=&quot;tcp://0.0.0.0:62623&quot; 
                zkAddress=&quot;192.168.0.107:2181,192.168.0.108:2181,192.168.0.109:2181&quot; 
                hostname=&quot;hfbin107&quot; 
                zkPath=&quot;/activemq/leveldb-stores&quot;/&gt;
&lt;/persistenceAdapter&gt;
</code></pre><p><img src="http://img.blog.csdn.net/20171223162503915?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="node1图片"></p>
<p><strong>第四处修改</strong></p>
<p>修改通信的端口，避免冲突,大概在120行：</p>
<pre><code>shell&gt;vim /opt/activemq-cluster/node1/conf/activemq.xml 
</code></pre><p><img src="http://img.blog.csdn.net/20171223163211246?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述"></p>
<p>修改这个文件的通信端口号，三个节点都需要修改（51511,51512,51513）</p>
<p>Ok，到此为止，我们的activemq集群环境已经搭建完毕！</p>
<h4 id="3-测试启动activemq集群"><a href="#3-测试启动activemq集群" class="headerlink" title="3 测试启动activemq集群"></a><strong>3 测试启动activemq集群</strong></h4><p>第一步：启动zookeeper集群，命令：zkServer.sh start </p>
<p>第二步：启动mq集群：顺序启动mq:</p>
<pre><code>shell&gt;/opt/activemq-cluster/node1/bin/activemq start（关闭stop） 
shell&gt;/opt/activemq-cluster/node2/bin/activemq start（关闭stop） 
shell&gt;/opt/activemq-cluster/node3/bin/activemq start（关闭stop） 
</code></pre><p><img src="http://img.blog.csdn.net/20171223163806772?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzM1MjQxNTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述"><br>第三步：查看日志信息： </p>
<pre><code>shell&gt;tail -f /opt/activemq-cluster/node1/data/activemq.log 
shell&gt;tail -f /opt/activemq-cluster/node2/data/activemq.log 
shell&gt;tail -f /opt/activemq-cluster/node3/data/activemq.log 
</code></pre><p>如果不报错，我们的集群启动成功，可以使用控制台查看！</p>
<p>这里有个小案例你可以试一下，运行结果需要你自己去动手了我这里截一两张图说明补了什么。具体操作我可以说一下你可以按照我说操作来看看结果如何。</p>
<p>生产端代码：<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Sender</span> </span>&#123;</div><div class="line">	</div><div class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</div><div class="line">		<span class="keyword">try</span> &#123;</div><div class="line">			<span class="comment">//第一步：建立ConnectionFactory工厂对象，需要填入用户名、密码、以及要连接的地址，均使用默认即可，默认端口为"tcp://localhost:61616"</span></div><div class="line">			ConnectionFactory connectionFactory = <span class="keyword">new</span> ActiveMQConnectionFactory(</div><div class="line">					ActiveMQConnectionFactory.DEFAULT_USER, </div><div class="line">					ActiveMQConnectionFactory.DEFAULT_PASSWORD, </div><div class="line">					<span class="string">"failover:(tcp://192.168.0.107:51511,tcp://192.168.0.108:51512,tcp://192.168.0.109:51513)?Randomize=false"</span>);</div><div class="line">			</div><div class="line">			<span class="comment">//第二步：通过ConnectionFactory工厂对象我们创建一个Connection连接，并且调用Connection的start方法开启连接，Connection默认是关闭的。</span></div><div class="line">			Connection connection = connectionFactory.createConnection();</div><div class="line">			connection.start();</div><div class="line">			</div><div class="line">			<span class="comment">//第三步：通过Connection对象创建Session会话（上下文环境对象），用于接收消息，参数配置1为是否启用是事务，参数配置2为签收模式，一般我们设置自动签收。</span></div><div class="line">			Session session = connection.createSession(Boolean.FALSE, Session.AUTO_ACKNOWLEDGE);</div><div class="line">			</div><div class="line">			<span class="comment">//第四步：通过Session创建Destination对象，指的是一个客户端用来指定生产消息目标和消费消息来源的对象，在PTP模式中，Destination被称作Queue即队列；在Pub/Sub模式，Destination被称作Topic即主题。在程序中可以使用多个Queue和Topic。</span></div><div class="line">			Destination destination = session.createQueue(<span class="string">"first"</span>);</div><div class="line">			</div><div class="line">			<span class="comment">//第五步：我们需要通过Session对象创建消息的发送和接收对象（生产者和消费者）MessageProducer/MessageConsumer。</span></div><div class="line">			MessageProducer producer = session.createProducer(<span class="keyword">null</span>);</div><div class="line">			</div><div class="line">			<span class="comment">//第六步：我们可以使用MessageProducer的setDeliveryMode方法为其设置持久化特性和非持久化特性（DeliveryMode），我们稍后详细介绍。</span></div><div class="line">			<span class="comment">//producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);</span></div><div class="line">			</div><div class="line">			<span class="comment">//第七步：最后我们使用JMS规范的TextMessage形式创建数据（通过Session对象），并用MessageProducer的send方法发送数据。同理客户端使用receive方法进行接收数据。最后不要忘记关闭Connection连接。</span></div><div class="line">			</div><div class="line">			<span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ; i &lt; <span class="number">500000</span> ; i ++)&#123;</div><div class="line">				TextMessage msg = session.createTextMessage(<span class="string">"我是消息内容"</span> + i);</div><div class="line">				<span class="comment">// 第一个参数目标地址</span></div><div class="line">				<span class="comment">// 第二个参数 具体的数据信息</span></div><div class="line">				<span class="comment">// 第三个参数 传送数据的模式</span></div><div class="line">				<span class="comment">// 第四个参数 优先级</span></div><div class="line">				<span class="comment">// 第五个参数 消息的过期时间</span></div><div class="line">				producer.send(destination, msg, DeliveryMode.NON_PERSISTENT, <span class="number">0</span> , <span class="number">1000L</span>);</div><div class="line">				System.out.println(<span class="string">"发送消息："</span> + msg.getText());</div><div class="line">				Thread.sleep(<span class="number">1000</span>);</div><div class="line">				</div><div class="line">			&#125;</div><div class="line"></div><div class="line">			<span class="keyword">if</span>(connection != <span class="keyword">null</span>)&#123;</div><div class="line">				connection.close();</div><div class="line">			&#125;			</div><div class="line">		&#125; <span class="keyword">catch</span> (Exception e) &#123;</div><div class="line">			e.printStackTrace();</div><div class="line">		&#125;</div><div class="line">		</div><div class="line">	&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>消费端：<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Receiver</span> </span>&#123;</div><div class="line"></div><div class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span>  </span>&#123;</div><div class="line">		<span class="keyword">try</span> &#123;</div><div class="line">			<span class="comment">//第一步：建立ConnectionFactory工厂对象，需要填入用户名、密码、以及要连接的地址，均使用默认即可，默认端口为"tcp://localhost:61616"</span></div><div class="line">			ConnectionFactory connectionFactory = <span class="keyword">new</span> ActiveMQConnectionFactory(</div><div class="line">					ActiveMQConnectionFactory.DEFAULT_USER, </div><div class="line">					ActiveMQConnectionFactory.DEFAULT_PASSWORD, </div><div class="line">					<span class="string">"failover:(tcp://192.168.0.107:51511,tcp://192.168.0.108:51512,tcp://192.168.0.109:51513)?Randomize=false"</span>);</div><div class="line">			</div><div class="line">			<span class="comment">//第二步：通过ConnectionFactory工厂对象我们创建一个Connection连接，并且调用Connection的start方法开启连接，Connection默认是关闭的。</span></div><div class="line">			Connection connection = connectionFactory.createConnection();</div><div class="line">			connection.start();</div><div class="line">			</div><div class="line">			<span class="comment">//第三步：通过Connection对象创建Session会话（上下文环境对象），用于接收消息，参数配置1为是否启用是事务，参数配置2为签收模式，一般我们设置自动签收。</span></div><div class="line">			Session session = connection.createSession(Boolean.FALSE, Session.AUTO_ACKNOWLEDGE);</div><div class="line">			</div><div class="line">			<span class="comment">//第四步：通过Session创建Destination对象，指的是一个客户端用来指定生产消息目标和消费消息来源的对象，在PTP模式中，Destination被称作Queue即队列；在Pub/Sub模式，Destination被称作Topic即主题。在程序中可以使用多个Queue和Topic。</span></div><div class="line">			Destination destination = session.createQueue(<span class="string">"first"</span>);</div><div class="line">			<span class="comment">//第五步：通过Session创建MessageConsumer</span></div><div class="line">			MessageConsumer consumer = session.createConsumer(destination);</div><div class="line">			</div><div class="line">			<span class="keyword">while</span>(<span class="keyword">true</span>)&#123;</div><div class="line">				TextMessage msg = (TextMessage)consumer.receive();</div><div class="line">				<span class="keyword">if</span>(msg == <span class="keyword">null</span>) <span class="keyword">break</span>;</div><div class="line">				System.out.println(<span class="string">"收到的内容："</span> + msg.getText());</div><div class="line">			&#125;			</div><div class="line">		&#125; <span class="keyword">catch</span> (Exception e) &#123;</div><div class="line">			e.printStackTrace();</div><div class="line">		&#125;</div><div class="line"></div><div class="line">		</div><div class="line">		</div><div class="line">		</div><div class="line">	&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>对代码不了解的可以去看我以前的文章。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这里你先启动消费端代码，让消费端一直在等，然后再启动生产端（生产端生产五十万条数字），生产到上百条时候我模拟Node1（Master）挂掉了然后看看Node2（Slave）或Node3（Slave）有没有一个节点成为Master，这个只是我说的之一更多模拟可以自己搞。</p>
<p>说明：如何知道Node1是Master，就看你创建ConnectionFactory工厂对象的连接地址第一个地址默认为Master，你要是想确认是不是这里需要辅助的一些工具了。在这我就不做说明了，要是人想了解可以给我留言。</p>
<p>转发者必须注明转发链接</p>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>Donate</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/weixinpay.png" alt="HuangFuBin WeChat Pay"/>
        <p>WeChat Pay</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.png" alt="HuangFuBin Alipay"/>
        <p>Alipay</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Zookeeper/" <i class="fa fa-tag"></i> Zookeeper</a>
          
            <a href="/tags/ActiveMQ/" <i class="fa fa-tag"></i> ActiveMQ</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/12/01/消息中间件之ActiveMQ整合Spring实现邮箱发送（四）/" rel="next" title="消息中间件之ActiveMQ整合Spring实现邮箱发送（四）">
                <i class="fa fa-chevron-left"></i> 消息中间件之ActiveMQ整合Spring实现邮箱发送（四）
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/12/19/liunx目录结构说明与常用命令（基于6.4版本）/" rel="prev" title="liunx目录结构说明与常用命令（基于6.4版本）">
                liunx目录结构说明与常用命令（基于6.4版本） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        <!-- JiaThis Button BEGIN -->
<div class="jiathis_style">
  <a class="jiathis_button_weixin"></a>
  <a class="jiathis_button_cqq"></a>
  <a class="jiathis_button_tsina"></a>
  <!--<a class="jiathis_button_tqq"></a>-->
  
  <!--<a class="jiathis_button_douban"></a>-->
  <!--<a class="jiathis_button_renren"></a>-->
  <a class="jiathis_button_qzone"></a>
  <!--<a class="jiathis_button_kaixin001"></a>-->
  <a class="jiathis_button_copy"></a>
  <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank"></a>
  <a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" >
  var jiathis_config={
    hideMore:false
  }
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END -->

      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="SOHUCS"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://avatars3.githubusercontent.com/u/26451830?s=400&u=fac2b4c7903b3ad1210b530e2d18e42fcb410b0a&v=4"
               alt="HuangFuBin" />
          <p class="site-author-name" itemprop="name">HuangFuBin</p>
           
              <p class="site-description motion-element" itemprop="description">My friend promised me to go if I had the road</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives/">
                <span class="site-state-item-count">107</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">28</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">37</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hfbin" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                    
                      GitHub
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=DmZ7b2BpaHtsZ2AgbGF9fU5oYXZjb2diIG1hYw" target="_blank" title="E-Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i>
                  
                    
                      E-Mail
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/3904243687/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1" target="_blank" title="Weibo">
                  
                    <i class="fa fa-fw fa-weibo"></i>
                  
                    
                      Weibo
                    
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.hfbin.cn/" title="Title" target="_blank">Title</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-前言"><span class="nav-number">1.</span> <span class="nav-text">1 前言</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-部署方案，ZooKeeper、ActiveMQ集群环境准备"><span class="nav-number">2.</span> <span class="nav-text">2 部署方案，ZooKeeper、ActiveMQ集群环境准备</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#2、1-Zookeeper方案"><span class="nav-number">2.1.</span> <span class="nav-text">2、1 Zookeeper方案</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2、2-ActiveMQ方案"><span class="nav-number">2.2.</span> <span class="nav-text">2、2 ActiveMQ方案</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2、3-Zookeeper集群搭建"><span class="nav-number">2.3.</span> <span class="nav-text">2、3 Zookeeper集群搭建</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2、4-ActiveMQ集群搭建"><span class="nav-number">2.4.</span> <span class="nav-text">2、4 ActiveMQ集群搭建</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-测试启动activemq集群"><span class="nav-number">3.</span> <span class="nav-text">3 测试启动activemq集群</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <!--
<div class="copyright display_zhanzhang" style="text-align: center !important;">
  <span class="author" itemprop="copyrightHolder">桂ICP备16010161号</span>
</div>
-->
<div class="copyright" style="text-align: center !important;">
  
  &copy;  2017 - 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">HuangFuBin</span>
</div>
<div class="copyright" style="text-align: center !important;">
	
	<div class="powered-by" style="text-align: center !important;">
	  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
	</div>

	<div class="theme-info" style="text-align: center !important;">
	  主题 -
	  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
		NexT.Mist
	  </a>
	</div>
	
</div>
<div class="copyright display_zhanzhang"  style="text-align: center !important;">
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1266987503'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1266987503%26online%3D1%26show%3Dline' type='text/javascript'%3E%3C/script%3E"));</script>
</div>
        

<div class="busuanzi-count">
  

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>


        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  




  
    <script type="text/javascript">
    (function(){
      var appid = 'cysX5MNF0';
      var conf = '504c8a8b8a5aff5f06dd805c527bbf0f';
      var width = window.innerWidth || document.documentElement.clientWidth;
      if (width < 960) {
      window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){
        window.changyan.api.config({appid:appid,conf:conf})});
      }
    })();
    </script>
    <script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
  



  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=5.1.2"></script>



  

  

  

  

  
  <script type="text/javascript" src="/js/src/js.cookie.js?v=5.1.2"></script>
  <script type="text/javascript" src="/js/src/scroll-cookie.js?v=5.1.2"></script>


  

  <!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/love.js"></script>
</body>

</html>
